package com.example.mapper;

import com.example.pojo.Emp;
import com.example.pojo.EmpExpr;
import com.example.pojo.EmpQueryParam;
import com.example.pojo.JobOption;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

@Mapper
public interface EmpMapper {
    @Select("select count(*) from emp e left join dept d on e.dept_id = d.id ")
    Long count();
    @Select("select e.*, d.name deptName from emp e left join dept d on e.dept_id = d.id limit #{start}, #{pageSize}")
    List<Emp> list(Integer start , Integer pageSize);
    //@Select("select * from emp limit #{start},#{pageSize}")
    List<Emp> page(EmpQueryParam param);


    void save(Emp emp);

    @Select("select * from emp")
    List<Emp> findAll();

    Emp findById(Integer id);



    void update(Emp emp);

    void Delete(List<Integer> ids);

    @MapKey("job_name")
    List<Map<String, Long>> getEmpJoData();
    @Select("select id,username,name from emp where username = #{username} and password = #{password}")
    Emp login(Emp emp);
    // 员工性别统计
    @MapKey("name")
    List<Map> getEmpGenderData();
}
